<template>
  <div class="test">
    <RenderTable 
      :superQueryFieldList="superQueryFieldList" 
      :queryParamArr = "queryParamArr"
      :defColumns="defColumns"
      :url = "url"
      @handleEdit = "handleEdit"
    >
    </RenderTable>

    <AttendanceSheetDetailModal ref="attendanceSheetDetailModal" :attendanceSignId="attendanceSignId" :empno = 'empno'></AttendanceSheetDetailModal>
  </div>
</template>

<script type="text/javascript">

import RenderTable from '@/components/renderTable'
import AttendanceSheetDetailModal from './modules/attendanceSheetDetailModal.vue'
import { timestampToDatetime } from "@/utils/util";

const superQueryFieldList =
[
  {
    value: "organization",
    text: "组织",
    type: "String",
  },  
  {
    value: "empname",
    text: "员工姓名",
    type: "String",
  },
]
export default {
  data() {
    return {
      attendanceSignId: '',
      empno: '',
      superQueryFieldList,
      queryParamArr: [
        {
          label: "线体",
          placeholder: "请输入线体",
          type: 'input',
          key: 'linename',
          value: ''
        }
      ],
      defColumns: [
        {
          title: "序号",
          dataIndex: "",
          key: "rowIndex",
          width: 60,
          align: "center",
          customRender: (t, r, index) => {
            return parseInt(index) + 1;
          },
        },
        {
          title: "日期",
          align: "center",
          dataIndex: "workdate",
          customRender: (t, r, index) => {
            return timestampToDatetime(t)
          },
        },
        {
          title: "车间",
          align: "center",
          dataIndex: "workroomname",
        },
        {
          title: "线体",
          align: "center",
          dataIndex: "linename",
        },
        {
          title: "线长",
          align: "center",
          dataIndex: "lineleader",
        },
        {
          title: "应到人数",
          align: "center",
          dataIndex: "shouldNumber",
        },
        {
          title: "实到人数",
          align: "center",
          dataIndex: "actualNumber",
        },
        {
          title: "借入人数",
          align: "center",
          dataIndex: "borrowNumber",
        },
        {
          title: "调出人数",
          align: "center",
          dataIndex: "lendNumber",
        },
        {
          title: "迟到人数",
          align: "center",
          dataIndex: "lateNumber",
        },
        {
          title: "请假人数",
          align: "center",
          dataIndex: "leaveNumber",
        },
        {
          title: "旷工人数",
          align: "center",
          dataIndex: "absentNumber",
        },
        {
          title: "制单人",
          align: "center",
          dataIndex: "makeBy",
        },
        {
          title: "制单日期",
          align: "center",
          dataIndex: "makeDate",
          customRender: (t, r, index) => {
            return timestampToDatetime(t)
          },          
        },
        {
          title: "操作",
          dataIndex: "action",
          align: "center",
          scopedSlots: { customRender: "action" },
        },
      ],
      url: {
        // list: '/mes-manpower/mesHrEmployeeinfo/list',
        list: '/mes-manpower/mesHrAttendanceSign/list',
      },
    
      layout: {
        labelCol: { span: 4 },
        wrapperCol: { span: 14 },
      },         
    }
  },
  mounted() {

  },
  methods: {
    handleEdit(record){
      console.log(record);
      
      this.attendanceSignId = record.id
      this.empno = record.empno
      this.$nextTick( () => {
        this.$refs.attendanceSheetDetailModal.showModal()
      } )
    },
  
  },
  components: {
    RenderTable,
    AttendanceSheetDetailModal    
  }
}
</script>

<style lang="less" scoped>
</style>
